import FunnelChart from '@/pages/IndexPage/components/funnelChart';
import SearchArea from '@/pages/IndexPage/components/SearchArea';
import { Card, Col, Row } from 'antd';
import dayjs from 'dayjs';
import { useState } from 'react';
import { paramDataType } from './data';
import styles from './index.less';

function IndexPage() {
  const [loading, setLoading] = useState(true);
  const dateFormat = 'YYYY-MM-DD';
  let initParams: paramDataType = {
    comp_type: '1',
    contrast_date: [
      dayjs().subtract(1, 'day').format(dateFormat),
      dayjs().subtract(1, 'day').format(dateFormat),
    ],
    date_pick: [],
    date_type: 'month',
    value_time: [
      dayjs().subtract(1, 'day').format(dateFormat),
      dayjs().subtract(1, 'day').format(dateFormat),
    ],
  };
  const [params, setParams] = useState({ ...initParams });
  const onSearch = (data) => {
    console.log('onSearch', data);
  };
  let funnelData = {
    headData: {
      tip: 'jyld',
      mainTipIcon: false,
      remarkTip: 'jy',
      remarkTipIcon: true,
      remark: '2023年5月财务已结账',
      upDateRemark: '数据最后更新：2023-06-06 10:48:15',
    },
    data: [],
  };
  let KCData = {
    headData: {
      tip: '000',
      mainTipIcon: true,
      remarkTip: '',
      remarkTipIcon: false,
      remark: '',
      upDateRemark: '数据最后更新：2023-07-06',
    },
    data: [
      {
        name: '0000',
        tipIcon: true,
        val: 25508000000,
        val2: 0,
        target: 41,
        tb: 19.76,
      },
      {
        name: '0000',
        tipIcon: true,
        val: 264,
        val2: 223,
        target: 41,
        tb: 1,
      },
    ],
  };
  let PFata = {
    headData: {
      tip: '111',
      mainTipIcon: true,
      remarkTip: '',
      remarkTipIcon: false,
      remark: '',
      upDateRemark: '数据最后更新：2023-07-06',
    },
    data: [
      {
        name: '1111',
        tipIcon: true,
        val: 25508000000,
        val2: 0,
        target: 41,
        tb: 19.76,
      },
      {
        name: '1111',
        tipIcon: true,
        val: 264,
        val2: 223,
        target: 41,
        tb: 1,
      },
    ],
  };
  setTimeout(() => {
    setLoading(false);
  }, 3000);
  return (
    <div className={styles.indexPage}>
      <Card>
        <SearchArea params={params} onSearch={onSearch} />
      </Card>
      <Row gutter={16} style={{ marginTop: '12px' }}>
        <Col span={16}>
          <Card>
            <FunnelChart data={funnelData}></FunnelChart>
          </Card>
        </Col>
        <Col span={8}>
          {/*<Space size={12} direction="vertical" className={styles.spaceArea}>*/}
          {/*  <Card><PlaneArea data={PFata}></PlaneArea></Card>*/}
          {/*  <Card><PlaneArea data={PFata}></PlaneArea></Card>*/}
          {/*</Space>*/}
        </Col>
      </Row>
    </div>
  );
}

export default IndexPage;
